<?php
declare(strict_types=1);
namespace Service\ActivityService;
use Service\BaseService;
use App\Model\BbcModel\ActivityDiscount;

/**
 * 活动:打折服务中心
 * @author chenshubo
 */
class ActivityDiscountService extends BaseService
{
    /**
     * 获取活动明细
     * @param array $actIds
     */
    public function getActDataList( array $actIds = [] )
    {
        if( empty($actIds) ) {
            return [];
        }
        return ActivityDiscount::instance()->whereIn('activity_id',$actIds)->get()->toArray();
    }
    
    /**
     * 获取分组功能
     * @param array $data
     */
    public function getMapList( array $data )
    {
        if( empty($data) ) {
            return [];
        }
    
        $temp = [];
        foreach ($data as $item)
        {
            $temp[$item['activity_id']][] = $item;
            unset($item);
        }
    
        return $temp;
    }
}